//
//  ImageWorkedViewController.h
//  Scanner
//
//  Created by TGBUS on 12-7-14.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
/*
 调节图片的控制器
 
 以下是CoreImage操作的键值
 
 调节颜色类的（明亮度，饱和度）
 CIColorControls:
 {
     CIAttributeFilterCategories =     (
     CICategoryColorAdjustment,
     CICategoryVideo,
     CICategoryStillImage,
     CICategoryInterlaced,
     CICategoryNonSquarePixels,
     CICategoryBuiltIn
     );
     CIAttributeFilterDisplayName = "Color Controls";
     CIAttributeFilterName = CIColorControls;
     inputBrightness =     {
     CIAttributeClass = NSNumber;
     CIAttributeDefault = 0;
     CIAttributeIdentity = 0;
     CIAttributeSliderMax = 1;
     CIAttributeSliderMin = "-1";
     CIAttributeType = CIAttributeTypeScalar;
     };
     inputContrast =     {
     CIAttributeClass = NSNumber;
     CIAttributeDefault = 1;
     CIAttributeIdentity = 1;
     CIAttributeSliderMax = 4;
     CIAttributeSliderMin = 0;
     CIAttributeType = CIAttributeTypeScalar;
     };
     inputImage =     {
     CIAttributeClass = CIImage;
     CIAttributeType = CIAttributeTypeImage;
     };
     inputSaturation =     {
     CIAttributeClass = NSNumber;
     CIAttributeDefault = 1;
     CIAttributeIdentity = 1;
     CIAttributeSliderMax = 2;
     CIAttributeSliderMin = 0;
     CIAttributeType = CIAttributeTypeScalar;
 };

 调节色相的Hue
 CIHueAdjust:
 {
     CIAttributeFilterCategories =     (
     CICategoryColorAdjustment,
     CICategoryVideo,
     CICategoryStillImage,
     CICategoryInterlaced,
     CICategoryNonSquarePixels,
     CICategoryBuiltIn
     );
     CIAttributeFilterDisplayName = "Hue Adjust";
     CIAttributeFilterName = CIHueAdjust;
     inputAngle =     {
     CIAttributeClass = NSNumber;
     CIAttributeDefault = 0;
     CIAttributeIdentity = 0;
     CIAttributeSliderMax = "3.141592653589793";
     CIAttributeSliderMin = "-3.141592653589793";
     CIAttributeType = CIAttributeTypeAngle;
     };
     inputImage =     {
     CIAttributeClass = CIImage;
     CIAttributeType = CIAttributeTypeImage;
     };
 }

 
 调节像素RGB的
 CIColorMatrix:
 {
     CIAttributeFilterCategories =     (
     CICategoryColorAdjustment,
     CICategoryVideo,
     CICategoryStillImage,
     CICategoryInterlaced,
     CICategoryNonSquarePixels,
     CICategoryBuiltIn
     );
     CIAttributeFilterDisplayName = "Color Matrix";
     CIAttributeFilterName = CIColorMatrix;
     inputAVector =     {
     CIAttributeClass = CIVector;
     CIAttributeDefault = "[0 0 0 1]";
     CIAttributeIdentity = "[0 0 0 1]";
     };
     inputBVector =     {
     CIAttributeClass = CIVector;
     CIAttributeDefault = "[0 0 1 0]";
     CIAttributeIdentity = "[0 0 1 0]";
     };
     inputBiasVector =     {
     CIAttributeClass = CIVector;
     CIAttributeDefault = "[0 0 0 0]";
     CIAttributeIdentity = "[0 0 0 0]";
     };
     inputGVector =     {
     CIAttributeClass = CIVector;
     CIAttributeDefault = "[0 1 0 0]";
     CIAttributeIdentity = "[0 1 0 0]";
     };
     inputImage =     {
     CIAttributeClass = CIImage;
     CIAttributeType = CIAttributeTypeImage;
     };
     inputRVector =     {
     CIAttributeClass = CIVector;
     CIAttributeDefault = "[1 0 0 0]";
     CIAttributeIdentity = "[1 0 0 0]";
     };
 }

 */

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import "ImageProcessedProtocal.h"
#import <AssetsLibrary/AssetsLibrary.h>
#import "MBProgressHUD.h"
#import "CustomAlert.h"

@interface ImageWorkedViewController : UIViewController<UIAlertViewDelegate,CustomAlertDelegate>
{
    BOOL isBackView;//是否是后面的视图，默认false,翻转动画用的变量
    BOOL isClear;   //是否已经clear的默认颜色
    int photoType;  //拍摄的胶卷的大小
}

@property(nonatomic,retain)CIContext *context;
@property(nonatomic,retain)CIFilter *metrixFilter;
@property(nonatomic,retain)CIFilter *colorFilter;
@property(nonatomic,retain)CIFilter *colorFilter2;
@property(nonatomic,retain)CIImage *processImage;
@property(nonatomic,assign)id<ImageProcessedProtocal> imageProcessDelegate;
@property(nonatomic,retain)NSString *sourceImagePath;                           //拍照后临时存到本地，便于GL视图读取
@property(nonatomic,retain)UIImageView *imgView;                                //存放图片的控件
@property(nonatomic,retain)UIToolbar *bottomToolBar;//操作栏
@property(nonatomic,retain)UISegmentedControl *segmentController;                //控制翻转动画的选项卡

@property(nonatomic,retain)UIImageView *brightLeftImgView;
@property(nonatomic,retain)UIImageView *brightRightImgView;
@property(nonatomic,retain)UIImageView *contrastLeftImgView;
@property(nonatomic,retain)UIImageView *contrastRightImgView;
@property(nonatomic,retain)UIImageView *redLeftImgView;
@property(nonatomic,retain)UIImageView *redRightImgView;
@property(nonatomic,retain)UIImageView *greenLeftImgView;
@property(nonatomic,retain)UIImageView *greenRightImgView;
@property(nonatomic,retain)UIImageView *blueLeftImgView;
@property(nonatomic,retain)UIImageView *blueRightImgView;


//屏幕左右下角的图片
@property(nonatomic,retain)UIImageView *brightImgView;
@property(nonatomic,retain)UIImageView *blanceImgView;

//显示滑竿的透明视图
@property(nonatomic,retain)UIView *sliderView;
//调节rgb的3个滑竿和指示标签
@property(nonatomic,retain)UILabel *lblRedToCyan;
@property(nonatomic,retain)UISlider *redSlider;
@property(nonatomic,retain)UISlider *greenSlider;
@property(nonatomic,retain)UISlider *blueSlider;

//调节亮度和对照的滑竿和标签
@property(nonatomic,retain)UILabel *lblBright;
@property(nonatomic,retain)UISlider *brightSlider;
@property(nonatomic,retain)UILabel *lblContrast;
@property(nonatomic,retain)UISlider *contrastSlider;

-(id)initWithPhotoType:(int)photoType;

-(void)refreshImageView;//外界调用，用来更新当前控制器的图片

@end
